# -*- coding: utf8 -*-
"""
    bit_torrent init
"""
import time
import signal

from multiprocessing import Process, Pipe
from base.settings import LOGGING

import logging.config
logging.config.dictConfig(LOGGING)
logger = logging.getLogger('bit_torrent')

from base.settings import DAEMON_CHECK_INTERVAL
from common.daemon import DaemonMonitor
from .tracker import TrackerDaemon
from .resource_distribute import ResourceDistributeDaemon


class BitTorrent(DaemonMonitor):
    def start(self):
        logger.info('启动 Bit Torrent 相关服务...')
        self.add_daemon(TrackerDaemon())
        self.add_daemon(ResourceDistributeDaemon())
        super(BitTorrent, self).start()
